﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body>
<h1>金袍子冰与火之歌名词中英对照翻译器</h1>
<p>V1.0 wiki版 Author :Reasno
</p><br>
<p>使用方法：在左边输入框中粘贴原文，单击按钮，右边输入框中会显示结果。
<form name="form1">
<textarea rows="30" name="text1" cols="100" wrap="virtual"></textarea>
<textarea rows="30" name="text2" cols="100" wrap="virtual"></textarea><br>
<input type="button" value="英文转中文" onClick="Button1_onclick()">
<input type="button" value="中文转英文" onClick="Button2_onclick()"><br>
</form>
<script type="text/javascript" >
	var phrase= new array();
	var singleword= new array();
	var wikiword= new array();//先转换词组，再转换单词，最后转wiki专用词，为以后扩展做准备。
	phrase["daenerys"]="丹妮";
	var text = "";
	var output = "";
	
	function Button1_onclick() {
		text = document.form1.text1.value;//TODO
		for (var i in phrase){
			output = text.replace(new regexp(i, "ig "),phrase[i]);
		}
		for (var i in singleword){
			output = text.replace(new regexp(i, "ig "),singleword[i]);
		}
		for (var i in wikiword){
			output = text.replace(new regexp(i, "ig "),wikiword[i]);
		}		
		
		alert("转换成功");
		document.form1.text2.value = output;
		
	function Button2_onclick() {
		text = document.form1.text1.value;//TODO
		for (var i in phrase){
			output = text.replace(new regexp(phrase[i], "ig "),i);
		}
		for (var i in singleword){
			output = text.replace(new regexp(singleword[i], "ig "),i);
		}
		for (var i in wikiword){
			output = text.replace(new regexp(wikiword[i], "ig "),i);
		}		
		output = text.replace(/daenerys/ig, "丹妮");
		alert("转换成功");
		document.form1.text2.value = output;
	//
	//var stringname = "?? ";   
	//var stringvalue = "va ";   
	//var expressionvalue = "??+??-?? ";   
	//expressionvalueexpressionvalue = expressionvalue.replace(new regexp(stringname, "g "),stringvalue)   
	//alert(expressionvalue); 
	//new regexp("daenerys","i g ")	
  
	
	
	}
				
        </script>
</body>
</html>
